Skip to content

refactor: every settings switch row is one SwitchRow component, and the descriptor table is gone - #2185

Merged
yw0nam merged 4 commits into
mainfrom
refactor/2142-switch-rows
Nov 30, 2026
Merged

yw0nam merged 4 commits into
mainfrom
refactor/2142-switch-rows

Conversation

@yw0nam

@yw0nam yw0nam commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Summary

The fourth and last #2142 follow-up: every settings on/off row is one component.

before   switch-row.ts: a descriptor table (14 rows from 14 optional stores, tab + position hints) → quick-controls.ts filters by tab → DescriptorRow
         listening-page-view.tsx: its own SwitchRow / VoiceRow / BargeInRow / BubbleRow
after    switches/switch-row.tsx: SwitchRow { className, labelKey, subKey?, ariaKey, labelIcon?: ReactNode, store, lock?, logKey?, log }
         each page receives its stores and renders <SwitchRow …/> in today's order; quick-controls.ts only passes stores
  • store is the shape every flag store already has (get().enabled, setEnabled, subscribe); the three stores that differ get a small adapter beside their page (message window: Tauri gate and the unified-chat lock, voice-page.ts; voice status and barge-in, listening-page.ts). Motion keeps whileOpen around each store's subscribe.
  • The 15 rows keep their class, label, sub line, aria, initial state, lock and log key, and their place on each page (checked row by row against the old table in review). The TTS glyph is now JSX, not an HTML string.
  • proactive/source-group.tsx takes the row's props and builds the row itself.
  • Concept rule switch-row: owner switches/switch-row.tsx:SwitchRow; <Switch in src/ui/quick-controls/**/*.tsx outside the owner. Baseline (settings rows not yet converted, refactor on touch): express-motion-section.tsx, idle-motion-section.tsx, perms-page-view.tsx, card-section.tsx, cue-list-group.tsx, plugin-group.tsx, one each. Excluded as other layouts: cue-row.tsx, characters-section.tsx, filler-section.tsx (the filler switch sits in its section head; FillerSection now reads its own store).

Behaviour deltas:

  • A page without a TTS store renders no TTS row and no empty group (it used to show an inert switch). Production always passes the store (wire-settings-window.ts:239).
  • Voice draws the message-window section only with its row.
  • The voice-input toggle logs { enabled } like every row (was { on }; nothing reads it).

Related issues

Closes #2142

Related decisions / docs

Owner decision on #2142 (latest comment): one shared switch-row component every page uses directly; the descriptor table is deleted. docs/agent-guide/design/settings-row-switch.md names the component; docs/agent-guide/architecture/map.js: switch-row-switch replaces descriptor-switch and listening-switch.

Runtime evidence (required for UI / DOM / runtime behavior)

N/A beyond tests — the rows render the same DOM; the panel's suites pin it: pnpm vitest run --project unit src/ui/quick-controls src/app/settings-window 80 files, 1038 tests; quick-controls.layout.test.ts (each page's section order) unchanged; VRT quick-controls.fold.vrt.test.ts, quick-controls.narrow.vrt.test.ts, settings-panel.tabs.vrt.test.ts 9/9.

Merge danger

  • Door: two-way.
  • Blast radius: every switch row in the settings window.

Tests

  • Setup-only rewrites (stores instead of createSwitchRows, every assertion kept): switches/switch-row.test.tsx (was descriptor-row.test.tsx), proactive-page.test.tsx, together-page.test.tsx, filler-section.test.tsx, speaker-section.test.tsx; motion-page.test.tsx and characters-section.test.tsx drop rows.
  • qc-toggles.test.ts: the case "renders the TTS switch with default aria-checked and clicking is a no-op when ttsSettings is absent" is removed (the inert row is gone); "places the one-voice switch in the Together page…" gains ttsSettings in its setup, as production passes it.
  • New, pinning current behaviour (rule 8 mutation proofs): "draws the TTS glyph before the label when the page has a TTS store" (deleting {labelIcon} from SwitchRow fails it); "renders no TTS row and no empty group without a TTS store" (rendering the group unconditionally fails it).

Verification

  • pnpm build passes (includes tsc typecheck)
  • pnpm test passes
  • pnpm lint passes (biome format + lint)
  • cargo test / cargo clippy pass (Rust changes) — none
  • Runtime evidence attached above, or N/A justified

pnpm gates once at ce61d6ee with CONCEPT_RULES_CHANGE_OK=1: every gate exit 0; the two review-fix commits after it pass the focused unit, VRT, typecheck, biome, css, rules and map checks. Two independent reviews (spec: row-by-row parity; standards): approve.

Checklist (YUI principles)

  • Schema changes update docs/reference/client-context.md alongside the code (none)
  • docs/agent-guide/architecture/map.js carries every module, part, and exchange this PR adds, removes, or changes
  • No unverified assumptions
  • No brain in the client
  • No inline control tags
  • No hardcoding
  • New/changed behavior ships a test in this PR

@yw0nam yw0nam added the rule-change A PR that deliberately changes a rule test (rule-tests.sh) or a concept rule (concept-rules.json) label Nov 30, 2026
@yw0nam
yw0nam merged commit 149da02 into main Nov 30, 2026
12 checks passed
@yw0nam
yw0nam deleted the refactor/2142-switch-rows branch November 30, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule-change A PR that deliberately changes a rule test (rule-tests.sh) or a concept rule (concept-rules.json)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wayfinder: one way per concept — consistency rules, refactored on touch

1 participant